package org.peoples.net {
	
	import flash.events.EventDispatcher;
	import flash.net.NetConnection;
	import flash.net.ObjectEncoding;
	
	public class PeoplesProxy extends EventDispatcher implements IPeoplesProxy {
		
		protected var conn:NetConnection;
		private var _uri:String;
		
		public function PeoplesProxy(uri:String, handler:Object):void {
			this.conn = new NetConnection();
			this.conn.objectEncoding = ObjectEncoding.AMF0;
			this._uri = uri;
			
			this.conn.client = handler;
		}
		
		public function connect():void {
			this.conn.connect(uri);
		}
		
		public function disconnect():void {
			this.conn.close();
		}
		
		protected function onFault(fault:Object):void {
			
		}
		
		protected function onResult(result:Object):void {
			
		}
		
		public function get connection():NetConnection {
			return conn;
		}
		
		public function get handler():Object {
			return conn.client;
		}
		
		public function get uri():String {
			return _uri;
		}
		
	}
	
}